package com.huluobo.a2204monthdemo.home

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.bean.HomeBannerBeanResult
import com.huluobo.base.bean.HomeGoodsBeanResult
import com.huluobo.base.bean.HomeNavBeanResult
import com.huluobo.base.viewmodel.BaseViewModel

/**
 *  Created by LC on 2024/8/7.
 */
class HomeViewModel : BaseViewModel<HomeRepo>() {

    val getHomeGoodsListSuccess = MutableLiveData<HomeGoodsBeanResult>()
    val getHomeGoodsListFailed = MutableLiveData<String>()

    val getHomeBannerSuccess = MutableLiveData<HomeBannerBeanResult>()
    val getHomeBannerFailed = MutableLiveData<String>()

    val getHomeNavSuccess = MutableLiveData<HomeNavBeanResult>()
    val getHomeNavFailed = MutableLiveData<String>()

    fun getHomeNav() {
        repo.getHomeNav(getHomeNavSuccess, getHomeNavFailed)
    }

    fun getHomeBanner() {
        repo.getHomeBanner(getHomeBannerSuccess, getHomeBannerFailed)
    }

    fun getHomeGoodsList(categoryId: Int, currentPage: Int, pageSize: Int) {
        repo.getHomeGoodsList(categoryId, currentPage, pageSize, getHomeGoodsListSuccess, getHomeGoodsListFailed)
    }

    override fun createRepo(): HomeRepo = HomeRepo()
}